//
//  UserDefinedCellForubViewForResults.m
//  HondaPro_2
//
//  Created by Eric on 13-7-9.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "UserDefinedCellForubViewForResults.h"

@interface UserDefinedCellForubViewForResults ()

//创建labels
-(void)initLabelsOnCell;

@end

@implementation UserDefinedCellForubViewForResults

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self initLabelsOnCell];
        
        self.selectionStyle = UITableViewCellSelectionStyleGray;
        self.backgroundColor = [UIColor clearColor];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark - 创建labels

-(void)initLabelsOnCell
{
    self.arrForAllLabelsKeysOnCell = [NSArray arrayWithObjects:
                                      @"statementNumber",
                                      @"stateContent", nil];
    
    NSDictionary *dicForStaticLabelsRect = [NSDictionary dictionaryWithObjectsAndKeys:
                                            [NSValue valueWithCGRect:CGRectMake(0, 0, 80, 50)],@"statementNumber",
                                            [NSValue valueWithCGRect:CGRectMake(81, 0, self.frame.size.width-81, 50)],@"stateContent", nil];
    
    self.dicForAllLabelsOnCell = [NSMutableDictionary dictionaryWithCapacity:[_arrForAllLabelsKeysOnCell count]];
    
    for (int i = 0; i<[_arrForAllLabelsKeysOnCell count]; i++)
    {
        NSString *strKeys = [_arrForAllLabelsKeysOnCell objectAtIndex:i];
        CGRect rect = (CGRect)[[dicForStaticLabelsRect objectForKey:strKeys] CGRectValue];
        UILabel *lbl = [[UILabel alloc] init];
        lbl.frame = rect;
        lbl.backgroundColor = [UIColor clearColor];
        lbl.textColor = [UIColor grayColor];
        lbl.font = [UIFont systemFontOfSize:16];
        lbl.numberOfLines = 2;
        [self.dicForAllLabelsOnCell setObject:lbl forKey:strKeys];
        [self.contentView addSubview:lbl];
        
        if (0 == i)
        {
            lbl.textAlignment = UITextAlignmentCenter;
        }
    }
}

@end
